<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回用于临时文件的目录</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.sys-get-temp-dir" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sys_get_temp_dir</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.1, PHP 7)</p><p class="refpurpose"><span class="refname">sys_get_temp_dir</span> &mdash; <span class="dc-title">返回用于临时文件的目录</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.sys-get-temp-dir-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>sys_get_temp_dir</strong></span>
    ( <span class="methodparam">void</span>
   ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   返回 PHP 储存临时文件的默认目录的路径。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sys-get-temp-dir-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回临时目录的路径。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.sys-get-temp-dir-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-535">
    <p><strong>Example #1 <span class="function"><strong>sys_get_temp_dir()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;使用&nbsp;sys_get_temp_dir()&nbsp;在目录里创建临时文件<br /></span><span style="color: #0000BB">$temp_file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tempnam</span><span style="color: #007700">(</span><span style="color: #0000BB">sys_get_temp_dir</span><span style="color: #007700">(),&nbsp;</span><span style="color: #DD0000">'Tux'</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">$temp_file</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
C:\Windows\Temp\TuxA318.tmp
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sys-get-temp-dir-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="tmpfile.html" class="function" rel="rdfs-seeAlso">tmpfile()</a> - 建立一个临时文件</span></li>
    <li class="member"><span class="function"><a href="tempnam.html" class="function" rel="rdfs-seeAlso">tempnam()</a> - 建立一个具有唯一文件名的文件</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>